package com.example.mapp;

import com.example.entity.authority.UserCheck;
import com.example.mapp.buildSql.UserCheckMappSql;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * Created by youkun on 2018/3/16.
 * 用户审核
 */
@Mapper
public interface UserCheckMapp {

    @Insert("insert into user_check (" +
            "user_name,role_Type_id,card_Type,party_Id,mobile,email,start_Time,success_Time," +
            "status,remarks,user_code,password,card_Number,card_Type_Number," +
            "file_List,face_url,role_id,firstgt,phone"+
            ") values (" +
            "#{userName},#{roleTypeId},#{cardType},#{partyId},#{mobile},#{email},#{startTime}," +
            "#{successTime},#{status},#{remarks},#{userCode},#{password},#{cardNumber}," +
            "#{cardTypeNumber},#{fileList},#{faceUrl},#{roleId},#{firstgt},#{phone}"+
            ") ")
    int insert(UserCheck userCheck)throws Exception;

    @Update("update user_check set user_name =#{userName}," +
            "role_Type_id=#{roleTypeId},card_Type=#{cardType},party_Id=#{partyId},mobile=#{mobile}," +
            "start_Time=#{startTime},status=#{status}," +
            " remarks=#{remarks},user_code=#{userCode},password=#{password},card_Number=#{cardNumber}," +
            "card_Type_Number=#{cardTypeNumber},file_List=#{fileList},face_url=#{faceUrl}," +
            "role_id=#{roleId},system_User_Id=#{systemUserId},firstgt=#{firstgt},phone=#{phone} where id=#{id}")
    int update(UserCheck userCheck) throws Exception;

    @Select("select * from user_check where id = #{id}")
    UserCheck queryById(String id) throws Exception;

    @Select("select * from user_check where card_number = #{cardNumber} and status!='3'")
    UserCheck queryByCardNumber(String cardNumber) throws Exception;

    @SelectProvider(
            type = UserCheckMappSql.class,
            method = "queryUserCheckList"
    )
    List<UserCheck> queryUserCheckList(UserCheck userCheck)throws Exception;


    @Delete(" delete  from user_check where system_User_Id=#{systemUserId}")
    int deleteBySystemUserId(String systemUserId)throws Exception;

}
